﻿ 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Volo.Abp;
using Volo.Abp.Domain.Repositories;
using Volo.Abp.Domain.Services;

namespace CodeMan.Domain.ClassGens
{
    public class CodeManDomainService : DomainService
    {
        private readonly IRepository<ClassGen, Int64> _codemanRepository;

        public CodeManDomainService(IRepository<ClassGen, Int64> codemanRepository) //注入默认仓储
        {
            _codemanRepository = codemanRepository;
        }

        public async Task<ClassGen> CreateClassGen(string name, string desc)
        {
            Check.NotNullOrWhiteSpace(name, nameof(name));

            var ClassGen = new ClassGen
            {
                Name = name,
                Desc = desc
            };

            await _codemanRepository.InsertAsync(ClassGen); //使用仓储提供的标准方法

            return ClassGen;
        }
    }

}
